<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎大家学习web开发</title>
    <style>
        .demo{
            width: 200px;
            height: 200px;
            /* red、green、blue、alpha----0-255 */
            /* 顺序red、green、blue----0-f十六进制色码值---0-9a-f */
            background-color: #ffffff;
            
        }
    </style>
</head>
<body>
    <h1 class="demo">标题</h1>   
    <!-- 注释：Ctrl+/ -->
    <script>
        // 1、获取元素
        var h1 = document.getElementsByClassName('demo')[0]
        // 2、绑定事件
        h1.onclick = function(){
            alert('您点击了标题')
        }
    </script>
</body>
</html>